package com.right.health.app.ui.main.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.magic.basic.adapter.BaseAbsAdapter;
import com.right.health.app.R;
import com.right.health.app.bean.HomeItem;


public class HouseholdFeature1Adapter extends BaseAbsAdapter<HomeItem> {

    public HouseholdFeature1Adapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if(convertView == null) {
            convertView = mInflater.inflate(R.layout.household_feature_item1, null);
            viewHolder = new ViewHolder();
            viewHolder.nameTv = (TextView) convertView.findViewById(R.id.tv_name);
            viewHolder.contentImage = (ImageView) convertView.findViewById(R.id.iv_show);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        HomeItem item = mDataSource.get(position);
        viewHolder.nameTv.setText(item.name);
        viewHolder.contentImage.setImageResource(item.res);
        return convertView;
    }

    private class ViewHolder {
        private ImageView contentImage;
        private TextView nameTv;
    }
}
